const Koa = require('koa2');
const KoaRouter = require('koa-router');
const conf=require('./mongoose/conf.js');
const app = new Koa();
// 创建 router 实例对象
const router = new KoaRouter();
//注册路由
router.get('/data', async (ctx, next) => {
  console.log('index');
  ctx.body = 'index1111';
});
const wechat = require('co-wechat') 
router.all('/wechat', wechat(conf).middleware(
  async message => {
  console.log('wechart', message)
  return 'Hello world! '+message.Content;
  } ))
app.use(router.routes());  // 添加路由中间件
app.use(router.allowedMethods()); // 对请求进行一些限制处理

app.listen(3000);